home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Libraries / tcl7.4b3 / tests / pid.test < prev    next >
Encoding:
Text File  |  1994-12-17  |  1.3 KB  |  45 lines

  1. # Commands covered:  pid
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright (c) 1991-1993 The Regents of the University of California.
  8. # Copyright (c) 1994 Sun Microsystems, Inc.
  9. #
  10. # See the file "license.terms" for information on usage and redistribution
  11. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12. #
  13. # @(#) pid.test 1.2 94/12/17 16:20:18
  14.  
  15. if {[string compare test [info procs test]] == 1} then {source defs}
  16.  
  17. catch {exec rm -f test1}
  18.  
  19. test open-1.1 {pid command} {
  20.     regexp {^[0-9]+$} [pid]
  21. } 1
  22. test open-1.2 {pid command} {
  23.     set f [open {| echo foo | cat > /dev/null} w]
  24.     set pids [pid $f]
  25.     close $f
  26.     list [llength $pids] [regexp {^[0-9]+$} [lindex $pids 0]] \
  27.         [regexp {^[0-9]+$} [lindex $pids 1]] \
  28.         [expr {[lindex $pids 0] == [lindex $pids 1]}]
  29. } {2 1 1 0}
  30. test open-1.3 {pid command} {
  31.     set f [open test1 w]
  32.     set pids [pid $f]
  33.     close $f
  34.     set pids
  35. } {}
  36. test open-1.4 {pid command} {
  37.     list [catch {pid a b} msg] $msg
  38. } {1 {wrong # args: should be "pid ?fileId?"}}
  39. test open-1.5 {pid command} {
  40.     list [catch {pid gorp} msg] $msg
  41. } {1 {bad file identifier "gorp"}}
  42.  
  43. catch {exec rm -f test1}
  44. concat {}
  45.